﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Coolzon.Realtime.ServerApp
{
    public class Config
    {
        public static Config Current { get; set; }

        public static AppSettings AppSettings { get; set; }

        public string IP { get; set; }

        public int Port { get; set; }

        public int MaxClientCount { get; set; }
        public int MaxDomainCount { get; set; }

        /// <summary>
        /// 获取配置文件的url地址
        /// </summary>
        /// <param name="baseUrl"></param>
        /// <returns></returns>
        public static string GetConfigUrl()
        {
            return string.Format("{0}Api/ConfigFile/Realtime-ServerApp", AppSettings.WebAppBaseUrl);
        }
        
        /// <summary>
        /// 获取日志存放目录
        /// </summary>
        /// <returns></returns>
        public static string GetLogDirectory()
        {
            return string.Format("{0}Logs\\", AppSettings.StorageDirectory);
        }

        /// <summary>
        /// 获取存放所有方案的目录
        /// </summary>
        /// <returns></returns>
        public static string GetSolutionsDirectory()
        {
            return string.Format("{0}Solutions\\", AppSettings.StorageDirectory);
        }
    }
    public class AppSettings
    {
        /// <summary>
        /// c:\\coolzon\\2.0\\Realtime.ServerApp\\
        /// </summary>
        public string StorageDirectory { get; set; }
        public string WebAppBaseUrl { get; set; }
    }
}
